import React from 'react';
import {Link} from "react-router-dom";
import {Button, Tooltip} from "antd";
import GUtils from "@/utils";

const Config = (Action) => {
    const Handlers = {
        enabled({id,enabled,name}) {
            enabled=!enabled;
            let op = enabled ? "启用" :"禁用";
            GUtils.confirm(op,`确认${op}门店 [${name}] 吗?`,()=>{
                Action.enabled(id, enabled);
            });
        }
    }
    const columns = [

        {title:"申请时间",dataIndex:"createTime",width:160, render:v=>GUtils.dateTimeFormatter(v)},
        {title:"门店名称",dataIndex:"shopName",width:120},
        {title:"负责人姓名",dataIndex:"shopManagerName",width:120},
        {title:"申请提现金额",dataIndex:"amount",width:120},
        {title:"状态",dataIndex:"status",width:120, render: v=> GUtils.dealEnumValue(v,"ShopWithdrawalStatus")},
        {title:"确认打款时间",dataIndex:"payTime",width:160,render:v=>GUtils.dateTimeFormatter(v)},
        {title:"打款凭证",dataIndex:"picUrl",width:120, render(v,vo){
            if( vo.status!=2){
                return "/";
            }
                return  <Tooltip autoAdjustOverflow trigger="click" overlayClassName="tip-img" placement="left" title={<img src={v}/>}> <a>点击查看</a></Tooltip>
        }},



    ];
    if(window.isRoot){
        columns.push(
            {title: '操作',dataIndex: 'id',width: 150,render(id,vo){
                    return <div>
                        {vo.status==1 && <a onClick={Action.preConfirmWithdrawal.bind(this,vo)}>修改打款状态</a>}
                    </div>
                }},
        )
    }
    return {
        ...window.CONFIG.getPagerConfig(Action), columns
    };
};


export default Config;
